home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / xlib04.zip / XLIB.INC < prev    next >
Text File  |  1992-11-04  |  4KB  |  146 lines

  1. ;-----------------------------------------------------------------------
  2. ;
  3. ; XLIB - Include file
  4. ;
  5. ; Global equates and variables
  6. ;
  7. ;
  8. ; ****** XLIB - Mode X graphics library                ****************
  9. ; ******                                               ****************
  10. ; ****** Written By Themie Gouthas                     ****************
  11. ;
  12. ; egg@dstos3.dsto.gov.au
  13. ; teg@bart.dsto.gov.au
  14. ;
  15. ; MODIFICATIONS:
  16. ;  26-9-92 :       Pel panning code added
  17. ;  23-10-92:       Added clip rectangle code
  18. ;-----------------------------------------------------------------------
  19.  
  20. ;
  21.  
  22. LOCALS
  23. .286
  24.  
  25. ; First lets find out what memory model to use
  26.  
  27. include model.inc
  28.  
  29.  
  30. AC_INDEX        equ  03c0h   ;Attribute controller index register
  31. MISC_OUTPUT     equ  03c2h   ;Miscellaneous Output register
  32. SC_INDEX        equ  03c4h   ;Sequence Controller Index
  33. GC_INDEX        equ  03ceh   ; Graphics controller Index
  34. CRTC_INDEX      equ  03d4h   ;CRT Controller Index
  35. DAC_READ_INDEX    equ  03c7h   ;
  36. DAC_WRITE_INDEX equ  03c8h   ;
  37. DAC_DATA    equ  03c9h   ;
  38. INPUT_STATUS_0 equ   03dah   ;Input status 0 register
  39.  
  40.  
  41. SCREEN_SEG    equ    0a000h  ;segment of display memory in mode X
  42.  
  43. MAP_MASK      equ    02h     ;index in SC of Map Mask register
  44. READ_MAP      equ    04h     ;index in GC of the Read Map register
  45. BIT_MASK      equ    08h     ;index in GC of Bit Mask register
  46.  
  47. OVERFLOW      equ    07h     ; CRTC overflow register index
  48. MAX_SCAN_LINE equ    09h     ; CRTC maximum scan line register index
  49. ADDR_HIGH     equ    0ch     ;Index of Start Address High reg in CRTC
  50. ADDR_LOW      equ    0dh     ;                       Low
  51. CRTC_OFFSET   equ    13h     ; CRTC offset register index
  52. UNDERLINE     equ    14h     ; CRTC underline location register index
  53. MODE_CONTROL  equ    17h     ; CRTC mode control register index
  54. LINE_COMPARE  equ    18h     ; CRTC line compare reg. index (bits 0-7 of
  55.                  ; split screen scan line
  56.  
  57. AC_MODE_CONTROL equ    10h   ; Index of Mode COntrol register in AC
  58. PEL_PANNING     equ    13h   ; Pel panning register index in AC
  59.  
  60. PATTERN_BUFFER equ 0fffch    ;offset in screen memory of pattern buffer
  61.  
  62. TRUE    equ 1
  63. FALSE   equ 0
  64.  
  65.  
  66. OK             equ 0
  67. ERROR          equ 1
  68.  
  69.  
  70. ;-----------------------------------------------------------------------
  71. ; Macro to wait for the vertical retrace leading edge
  72.  
  73. WaitVsyncStart   macro
  74.     mov     dx,INPUT_STATUS_0
  75. @@WaitNotVsync:
  76.     in      al,dx
  77.     test    al,08h
  78.     jnz     @@WaitNotVsync
  79. @@WaitVsync:
  80.     in      al,dx
  81.     test    al,08h
  82.     jz      @@WaitVsync
  83.     endm
  84.  
  85. ;-----------------------------------------------------------------------
  86. ; Macro to wait for the vertical retrace trailing edge
  87.  
  88. WaitVsyncEnd    macro
  89.     mov     dx,INPUT_STATUS_0
  90. @@WaitVsync2:
  91.     in      al,dx
  92.     test    al,08h
  93.     jz     @@WaitVsync2
  94. @@WaitNotVsync2:
  95.     in      al,dx
  96.     test    al,08h
  97.     jnz      @@WaitNotVsync2
  98.     endm
  99.  
  100. ;--- Word out macro ------------------------------------------
  101.  
  102.      WORDOUT  macro
  103.      IFDEF nw
  104.        out  dx,al
  105.        inc  dx
  106.        xchg al,ah
  107.        out  dx,al
  108.        xchg al,ah
  109.        dec  dx
  110.      ELSE
  111.        out  dx,al
  112.      ENDIF
  113.      endm
  114.  
  115. ;------------------------------------------------------------------------
  116. ; Global variables - XMAIN exports
  117. ;
  118.      global _InGraphics             :byte
  119.      global _CurrXMode              :word
  120.      global _ScrnPhysicalByteWidth  :word
  121.      global _ScrnPhysicalPixelWidth :word
  122.      global _ScrnPhysicalHeight     :word
  123.      global _ErrorValue             :byte
  124.  
  125.      global _SplitScrnOffs          :word
  126.      global _SplitScrnScanLine      :word
  127.      global _SplitScrnVisibleHeight :word
  128.      global _Page0_Offs             :word
  129.      global _Page1_Offs             :word
  130.      global _ScrnLogicalByteWidth   :word
  131.      global _ScrnLogicalPixelWidth  :word
  132.      global _ScrnLogicalHeight      :word
  133.  
  134.      global _MaxScrollX             :word
  135.      global _MaxScrollY             :word
  136.      global _DoubleBufferActive     :word
  137.      global _VisiblePageIdx         :word
  138.      global _VisiblePageOffs        :word
  139.      global _HiddenPageOffs         :word
  140.      global _NonVisual_Offs         :word
  141.          global _TopClip                :word
  142.          global _BottomClip             :word
  143.          global _LeftClip               :word
  144.          global _RightClip              :word
  145.  
  146.